<template>
<div>
  <h1>登录页面</h1>
  <p>用户名<input type="text" v-model="form.name"></p>
  <p>密码<input type="text" v-model="form.password"></p>
  <button @click="add">登录</button>
</div>
</template>

<script>
export default {
  name: "wlogin",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    add(){
      this.$axios.post('users/Wenzhang_API/',this.form)
      .then(i=>{
        if (i.data.code==200){
          alert(i.data.mes)
          localStorage.setItem('userid',i.data.userid)
          this.$router.push('wenzhang/')
        }
        else {
          alert(i.data.mes)
        }
      })
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>
